<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<p:dialog xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" 
	xmlns:pe="http://primefaces.org/ui/extensions"
	modal="true" width="660" height="500" resizable="false" 
	widgetVar="dialogListServicoAddFuncionario" id="listDialogServicoAddFuncionario"
	appendToBody="true">

	<link type="text/css" rel="stylesheet" href="../../resources/css/style.css" />
	
	<f:facet name="header">
			<h:outputText value="Consultar Serviço"/>
	</f:facet>
	
	<h:form prependId="false" id="formListServicoAddFuncionario">
		<div style="margin-left:5%;">
			<p:messages autoUpdate="true"/>
			<h:panelGrid columns="7">
				<h:outputText value="Filtrar por:" />
								
				<p:inputText id="inputSearchFilterCodServicoAddFuncionario" style="width:50px;" value="#{ordemServicoBean.filterId}" title="Código" maxlength="15">
					<pe:keyFilter regEx="/[\d]/" />
				</p:inputText>
				<p:watermark value="Código" for="inputSearchFilterCodServicoAddFuncionario"/>
				
				<p:inputText id="inputSearchFilterServicoAddFuncionario" style="width:250px;" value="#{ordemServicoBean.filter}" maxlength="50" title="Descrição"/>
				<p:watermark value="Descrição" for="inputSearchFilterServicoAddFuncionario"/>
				
				<p:commandButton icon="ui-icon-search" style="height:24px;" title="Consultar" id="searchServicoAddFuncionario" update="@form" actionListener="#{ordemServicoBean.fillServicoByFilterAddFuncionario}"/>
				<p:commandButton icon="ui-icon-check" title="Selecionar" actionListener="#{ordemServicoBean.addServicoAddFuncionario}" process="@this formListServicoAddFuncionario" update="formListServicoAddFuncionario, tableListServicosAddFuncionario" style="height:24px;"/>
			</h:panelGrid>
		
			<div style="padding-top:10px;">
				<p:dataTable style="width:560px" var="servico" id="tableListServicosAddFuncionario"
					value="#{ordemServicoBean.servicosToAdd}"
					paginator="true" rows="10" paginatorPosition="bottom"
					selection="#{ordemServicoBean.selectedServicos}" rowKey="#{servico.id}"
					emptyMessage="Não há registros">  
					
					<p:column selectionMode="multiple" style="text-align:center; width:15px;"/>
					<p:ajax event="rowDblselect" listener="#{ordemServicoBean.addServicoAddFuncionario}"/>
				 
					<p:column headerText="Descrição">  
				    	<h:outputText value="#{servico.descricao}" />  
					</p:column> 	
			  	</p:dataTable>
			</div>
		</div>
	</h:form>
</p:dialog>